<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.dems.dao.StudentDao"%>
<%@ page import="com.dems.domain.Student"%>
<%@ page import="com.dems.dao.RepairDao"%>
<%@ page import="com.dems.domain.Repair"%>
<%@ page import="java.util.List" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/information.css"/>
<title>维修信息</title>
</head>
<body>
	<table border="4px">
		<caption class="title">维修信息</caption>
        <tbody>
       		<tr>
           		<th>学生姓名</th>
                <th>维修描述</th>
                <th>维修类型</th>
                <th>维修状态</th>
                <th>维修工人姓名</th>
                <th>维修工人手机号</th>
                <th>确认维修结果</th>
            </tr>
        <%
        Student student = (Student)request.getSession().getAttribute("student");
        String studentNum = student.getStudentNum();
        Repair repair = new Repair();
        RepairDao repairDao = new RepairDao();
        List<Repair> repairs = repairDao.selectRepairBystudentNum(studentNum);
        for(Repair r : repairs){
        	%>
        	<tr>
                <td><%=r.getStudentName() %></td>
                <td><%=r.getRepairDescription() %></td>
                <td><%=r.getRepairType() %></td>
                <td><%=r.getRepairState() %></td>
                <td><%=r.getMpName() %></td>
                <td><%=r.getMpPhone() %></td>
                <%if(r.getRepairState().equals("维修完成")){%>
                <td>
                	<form action="<%=request.getContextPath() %>/RepairResultServlet">
                		<input type="hidden" name="repairId" value="<%=r.getRepairId() %>"/>
                		<input type="radio" name="repairState" value="success" checked="checked"> 成功
        				<input type="radio" name="repairState" value="failure"> 失败
                		<button type="submit">确定</button>
                	</form>
                </td>
                <%}else{ %>
                <td></td>
                <%} %>
            </tr>
            
         <%} %>
         </tbody>
	</table>
</body>
</html>